#pragma once

#include "Common.h"

class CentralCache
{
public:

	CentralCache(const CentralCache&) = delete;
	CentralCache(CentralCache&&) = delete;

	CentralCache& operator=(const CentralCache&) = delete;
	CentralCache& operator=(CentralCache&&) = delete;

	static CentralCache* getInstance()
	{
		return &_centralCacheSelf;
	}

	size_t fetchRangeObject(void*&, void*&, size_t, size_t);

	Span* getOneSpan(SpanList&, size_t);

	void releaseListToSpans(void*, size_t);

private:

	CentralCache() = default;
	~CentralCache() = default;

	SpanList _spanLists[RIGHT_NFREELIST];

	static CentralCache _centralCacheSelf;
};

